<!DOCTYPE html>
<html>
<head>
    {include file='public/head'}
    <style>
        .over{color: #CD5C5C;}
    </style>
</head>
<body>
<div class="g-flexview">
    <header class="m-navbar">
        <a href="javascript:history.back();" class="navbar-item">
            <i class="back-ico"></i>
        </a>
        <div class="navbar-center"><span class="navbar-title">{$worker['name']}</span></div>
    </header>
    <div class="g-scrollview">
        <div style="margin: 10px auto;width: 50%;">
            <img width="100%" src="{$worker['img']}" height="100%">
        </div>
        <div class="m-grids-2">
            <a href="#" class="grids-item">
                <div class="grids-txt">
                    <p style="height: 36px;line-height: 36px;">{$worker['name']}</p>
                </div>
            </a>
            <a href="#" class="grids-item">
                <div class="grids-txt">
                    <p style="margin-bottom: 4px;">需HX: {$worker['money']}</p>
                    <p>每日产能: {$worker['make']}HX</p>
                </div>
            </a>
        </div>
        <div class="m-button">
            <button type="button" class="btn-block btn-primary buy" data-id="{$worker['id']}">立即购买</button>
        </div>
    </div>
</div>
{include file='public/js'}
<script>
    !function ($) {
        $('.buy').click(function () {
            var id = $(this).data('id');
            dialog.confirm("{$worker['name']}","您购买的 <span class='over'>{$worker['name']}</span> 需要 <span class='over'>{$worker['money']}</span> HX",function () {
                $.post('/index/shop/buyWorker',{id : id},function (res) {
                    dialog.toast(res.msg,'none',1000);
                });
            });
        });
    }(jQuery);
</script>
</body>
</html>